/**
 * Copyright (C) 2010 altuure <altuure [AT] gmail [DOT] com> http://www.altuure.com/projects/yagdao
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.altuure.yagdao;

import java.io.Serializable;
import java.util.List;

/**
 * Common dao with all properties can be used for any entity 
 */
public interface CommonDAO {
    void save(Object entity);

    Object load(Class objectClass, Serializable id);

    SearchResultList getAll(Class objectClass);

    SearchResultList getAll(Class objectClass, YPage paging);

    Object get(Class objectClass, Serializable Serializable);

    Object fetch(Class objectClass, Serializable Serializable);

    long count(Class objectClass);

    void update(Object object);

    void deleteById(Class objectClass, Serializable serializable);

    void delete(Object object);

    SearchResultList<Object> fetchAll(Class objectClass);

    SearchResultList<Object> fetchAll(Class objectClass, YPage paging);

    String getIdProperty(Class objectClass);

    void detach(Object entity);

    Object getId(Object entity);

    void  flush();

    SearchResultList query(Class objectClass, YQuery query, YPage paging);
}
